Skip to content

fix(fresh): accept class + standard <form> attrs on managed Form formProps (#213)#228

Merged
rickylabs merged 1 commit into
mainfrom
fix/managed-form-formprops-attrs
Jul 1, 2026
Merged

fix(fresh): accept class + standard <form> attrs on managed Form formProps (#213)#228
rickylabs merged 1 commit into
mainfrom
fix/managed-form-formprops-attrs

Conversation

@rickylabs

Copy link
Copy Markdown
Owner

Summary

Widen the managed @netscript/fresh/form <Form> formProps surface so callers can pass class, standard form attributes, ARIA/data attributes, and framework attributes through the form prop bag.

The render path now strips enhancement-owned handler/ref keys from formProps before spreading, preserving managed submit/enhancement ownership while keeping existing top-level prop behavior.

Scope

  • Archetype / area: @netscript/fresh form public surface, Archetype 4 + frontend overlay
  • Fixes the managed form DX/typing issue for formProps attrs

Slices

  • S1 Widen managed form element prop bags and add render/type regression — dde00ba

Validation

  • deno check --unstable-kv packages/fresh/src/application/form/mod.ts packages/fresh/src/application/form/components/form.test.tsx — PASS
  • deno test --allow-all packages/fresh/src/application/form/components/form.test.tsx — PASS, 4 passed / 0 failed
  • deno fmt --check packages/fresh/src/application/form/_internal/prop-types.ts packages/fresh/src/application/form/components/form.tsx packages/fresh/src/application/form/components/form.test.tsx packages/fresh/src/application/form/_internal/types.ts packages/fresh/src/application/form/runtime/types.ts packages/fresh/src/application/form/mod.ts — PASS
  • rtk proxy deno task --cwd packages/fresh check — PASS
  • rtk proxy deno task --cwd packages/fresh lint — PASS
  • rtk proxy deno task --cwd packages/fresh fmt:check — PASS
  • rtk proxy deno task --cwd packages/fresh publish:dry-run — PASS
  • rtk proxy deno task check — PASS
  • rtk proxy deno task lint — PASS
  • rtk proxy deno task fmt:check — PASS
  • rtk proxy deno task --cwd packages/fresh doc-lint — FAIL, existing unrelated InferRoutePattern* / NetScriptVitePlugin private-type refs plus npm type-resolution warnings; the changed form types no longer produce doc-lint errors.

Harness

  • Run dir: .llm/tmp/run/fix-managed-form-formprops-attrs--213/
  • PLAN-EVAL: final PASS after two procedural gate-enumeration fixes and user-visible escalation
  • IMPL-EVAL: pending

Drift / Debt

  • Drift recorded: public Preact JSX aliases caused deno doc --lint private-type refs, so the implementation uses self-contained form prop interfaces with explicit managed fields and an open attribute index.
  • New debt: none

Closes #213

@augmentcode

augmentcode Bot commented Jul 1, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: This PR expands the managed @netscript/fresh/form <Form> formProps surface so callers can pass class plus standard form/ARIA/data/framework attributes.

Changes:

  • Introduces FormElementOverrideProps and widens form element prop types with an open attribute index signature
  • Blocks managed submit/enhancement handler keys and ref from being overridden via formProps
  • Updates the Form component to strip enhancement-owned keys before spreading
  • Adds a regression test validating attribute forwarding while preserving managed hidden inputs

Technical Notes: Keeps progressive enhancement ownership of onSubmit/onBlurCapture/onInputCapture/ref while allowing broader pass-through attributes.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 1 suggestion posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

/** Caller overrides accepted by the managed form component's `formProps` bag. */
export interface FormElementOverrideProps {
/** Additional standard, ARIA, data, or framework attributes for the form element. */
readonly [attribute: string]: unknown;

@augmentcode augmentcode Bot Jul 1, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

packages/fresh/src/application/form/_internal/prop-types.ts:28 — The open index signature on FormElementOverrideProps means callers can pass framework-only props like dangerouslySetInnerHTML/children, which can prevent the managed hidden inputs (submission id + CSRF) from rendering. Consider explicitly preventing those props in formProps similar to how handler/ref keys are blocked/stripped.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

@rickylabs
rickylabs merged commit 8bb873c into main Jul 1, 2026
6 checks passed
@rickylabs
rickylabs deleted the fix/managed-form-formprops-attrs branch July 1, 2026 23:51
rickylabs added a commit that referenced this pull request Jul 2, 2026
…eature sweep (#233)

Storefront tutorial D-01…D-05 conformance to the shipped #206#231 surface,
plus accuracy reconciliation on the fresh-ui/web-layer pages the sweep touched.

D-01 (01-scaffold): Aspire dashboard URL is https; fileTree includes
  database/ and tests/.
D-02 (02-catalog-service): real #208 CRUD surface — createCrudContract +
  @database/zod + context.db; errors thrown via the contract's typed
  errors.NOT_FOUND (no hand-rolled notFound import); router nests health
  under products (no invented health-router import).
D-03 (03-cart-contracts): register in mod.ts, PascalCase CartContractV1,
  import from @my-shop/contracts and the ./versions/v1 subpath. Reconciled
  02's products.contract.ts exports to the same PascalCase convention
  (ProductsContract/ProductsContractV1) so ch2↔ch3 imports agree.
D-04 (04/05): public `netscript plugin install saga|trigger --name … --samples`.

Feature recon to the sweep: DataTable→DataGrid (#209/#225), Icon primitive
(#211/#224) and DataGrid in fresh-ui root exports, Dropzone/prompt-input
mentions (#214/#229, #212/#226), managed <Form> class + <form> attrs
(#213/#228), useIslandMutation onMutate/onSettled (#210/#227).

Docs-only. build + check:links + check:caveats green. Refs #153.


Claude-Session: https://claude.ai/code/session_012wKHquACkXnWPDgJYhhFjN

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

form: managed <Form> rejects class/arbitrary attrs on formProps (DX gap)

1 participant